<?php
 $llist=explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
 foreach ($llist as $index => $t1){$llist[$index]=preg_replace('|;.*?$|','',strtolower($t1));}
 $llist=array_flip($llist);
 
 $LANGS=array();
 $langs=scandir($sad_root.'/i/lang/');
 foreach ($langs as $lang){
  if (!preg_match('|^lang_([a-z0-9]+)\\.inc$|',$lang,$a)){continue;}
  if ($a[1]=='en'){continue;}
  
  include($sad_root.'/i/lang/'.$lang);
  if (count($LANGS_t)>0){break;}
 }
 if (count($LANGS_t)<1){require_once($sad_root.'/i/lang/lang_en.inc');}
 $LANGS=$LANGS_t;
?>